<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="/WEB-INF/maa.tld" prefix="m" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<fmt:setLocale value="${language}"/>
<fmt:bundle basename="messages" prefix="account.">
    <html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="shortcut icon" href="${pageContext.servletContext.contextPath}/static/yin.ico">

        <title><fmt:message key="title"/></title>

        <link href="${pageContext.servletContext.contextPath}/static/bootstrap/css/bootstrap.css" rel="stylesheet">
        <link href="${pageContext.request.contextPath}/css/account.css" rel="stylesheet">

        <script src="../../assets/js/ie8-responsive-file-warning.js"></script>

        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>

        <style id="holderjs-style" type="text/css"></style>
    </head>
    </head>

    <body>
    <div class="navbar-wrapper">
        <div class="container-fluid">
            <div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
                <div class="container">
                    <div class="navbar-header">
                        <button type="button" class="navbar-toggle" data-toggle="collapse"
                                data-target=".navbar-collapse">
                            <span class="sr-only">Toggle navigation</span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                        </button>
                        <a class="navbar-brand" href="/maa/do?action=main"> <img
                                src="${pageContext.servletContext.contextPath}/static/ics.png"/>Silver Dragon</a>
                    </div>
                    <div class="navbar-collapse collapse">
                        <ul class="nav navbar-nav navbar-right">
                            <li><a><strong><fmt:message key="greet"/> ${user.name} ${user.surname}!</strong></a></li>
                            <li><a href="/maa/do?action=main"><fmt:message key="main"/></a></li>
                            <m:language/>
                            <li>
                                <form action="/maa/do" method="post">
                                    <input type="hidden" name="action" value="logout">
                                    <input class="btn btn-default navig" type="submit"
                                           value="<fmt:message key="logout"/>"/>
                                </form>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="container-fluid">
        <div class="row">
            <div class="col-sm-3 col-md-2 sidebar">
                <ul class="nav nav-sidebar">
                    <li class="active"><a href="/maa/do?action=account"><fmt:message key="overview"/></a></li>
                    <c:if test="${not empty user and user.role == 'CLIENT'}">
                        <li><a href="/maa/do?action=my-subscriptions"><fmt:message key="mysubs"/></a></li>
                        <li><a href="/maa/do?action=courses"><fmt:message key="subscirbe"/></a></li>
                    </c:if>
                    <li><a href="/maa/do?action=user-self-update"><fmt:message key="edit"/></a></li>
                    <c:if test="${not empty user and user.role == 'MENTOR'}">
                        <li><a href="/maa/do?action=my-courses"><fmt:message key="mycourses"/></a></li>
                    </c:if>
                </ul>
            </div>
            <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
                <h2 class="page-header"><fmt:message key="myinfo"/></h2>

                <div class="table-responsive">
                    <table class="table table-striped">
                        <thead>
                        <tr>
                            <th><fmt:message key="name"/></th>
                            <th><fmt:message key="surname"/></th>
                            <th><fmt:message key="email"/></th>
                            <th><fmt:message key="birthdate"/></th>
                            <th><fmt:message key="gender"/></th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr>
                            <td class="green">${user.name}</td>
                            <td class="grey">${user.surname}</td>
                            <td class="green">${user.email}</td>
                            <td class="green">${user.birthdate}</td>
                            <td class="grey">${user.gender}</td>
                        </tr>
                        </tbody>
                    </table>
                </div>
                <form action="/maa/do">
                    <input type="hidden" name="action" value="user-self-update"/>
                    <input class="btn mybtn" type="submit" value="<fmt:message key="edit"/>"/>
                </form>
                <c:if test="${not empty no_subscriptions}">
                    <h2 class="page-header"><fmt:message key="nosubs"/></h2>

                    <p>

                    <form action="/maa/do" method="post">
                        <input type="hidden" name="action" value="courses"/>
                        <input type="hidden" name="course-uuid" value=${course.uuid}/>
                        <input class="btn" type="submit" value="<fmt:message key="sub"/>"/>
                    </form>
                    </p>
                </c:if>
                <c:if test="${not empty courses}">
                    <h2 class="page-header"><fmt:message key="mysubs"/></h2>

                    <div class="table-responsive">
                        <table class="table table-striped">
                            <tr>
                                <th><fmt:message key="name"/></th>
                                <th><fmt:message key="description"/></th>
                                <th><fmt:message key="price"/></th>
                                <th><fmt:message key="mentor"/></th>
                                <th></th>
                            </tr>
                            <c:forEach items="${courses}" var="course">
                                <tr>
                                    <td>${course.courseName}</td>
                                    <td>${course.courseDescription}</td>
                                    <td>${course.courseMonthlyPrice}</td>
                                    <td>${course.mentor.name} ${course.mentor.surname}</td>
                                    <td>
                                        <form action="/maa/do" method="post">
                                            <input type="hidden" name="action" value="unsubscribe"/>
                                            <input type="hidden" name="course-uuid" value=${course.uuid}/>
                                            <input class="btn" type="submit" value="<fmt:message key="unsub"/>"/>
                                        </form>
                                    </td>
                                </tr>
                            </c:forEach>
                        </table>
                    </div>
                </c:if>
                <c:if test="${not empty groups}">
                    <h2 class="page-header"><fmt:message key="mycourses"/></h2>

                    <div class="table-responsive">
                        <table class="table table-striped">
                            <tr>
                                <th><fmt:message key="course"/></th>
                                <th><fmt:message key="clients"/></th>
                            </tr>
                            <c:forEach items="${groups}" var="group">
                                <tr>
                                    <td>${group.course.courseName}</td>
                                    <td class="myleft">
                                        <ol>
                                            <c:forEach items="${group.userList}" var="user">
                                            <li><p>  ${user.name} ${user.surname}
                                                </c:forEach>
                                        </ol>
                                    </td>
                                </tr>
                            </c:forEach>
                        </table>
                    </div>
                </c:if>
            </div>
        </div>
    </div>

    <script src="./Dashboard Template for Bootstrap_files/jquery.min.js"></script>
    <script src="./Dashboard Template for Bootstrap_files/bootstrap.min.js"></script>
    <script src="./Dashboard Template for Bootstrap_files/docs.min.js"></script>


    </body>
    </html>

</fmt:bundle>
